#!/bin/sh

# log_df
# File ID: 99575e5c-5d3e-11df-9eee-90e6ba3022ac

logdir=$HOME/log

[ -d $logdir ] || mkdir -p logdir || { echo "mkdir $logdir: På trynet" >&2; exit 1; }
[ -x /usr/bin/cronolog ] || { echo "Fant ikke /usr/sbin/cronolog, avbryter." >&2; exit 1; }

[ -r $logdir/.disks ] || { echo "$logdir/.disks finnes ikke, avbryter." >&2; exit 1; }

df -P `cat $logdir/.disks` |
    grep / |
    uniq |
    perl -pe 'chomp(my $a = `date -u +"%Y-%m-%dT%H:%M:%SZ"`); s/^/$a /;' |
    /usr/bin/cronolog -z 0 -S $logdir/curr_df $logdir/df/%Y/%Y-%m-%d.df.log
~/bin/log_df_pg
